Promise.allSettled = function (PromiseArr) {
    let result = []
    return new Promise((resolve, reject) => {
        PromiseArr.forEach((item, index) => {
            Promise.resolve(item).then(val => {
                result.push({
                    status: 'fulfilled',
                    value: val,
                })
                if (result.length === PromiseArr.length) {
                    resolve(result)
                }
            }, err => {
                result.push({
                    status: 'rejected',
                    reason: err,
                })
                if (result.length === PromiseArr.length) {
                    resolve(result)
                }
            })
        })
    })
}